package com.foxzzz.link;


import com.foxzzz.base.ListNode;


public class Solution83 {

    public ListNode deleteDuplicates(ListNode head) {
        ListNode prev = head;
        while (prev != null) {
            if (prev.next != null && prev.val == prev.next.val) {
                prev.next = prev.next.next;
            } else {
                prev = prev.next;
            }
        }

        return head;
    }


    public static void main(String[] args) {
        ListNode listNode = ListNode.getListNode("[1,1,1,2,3,3]");
        Solution83 solution83 = new Solution83();
        solution83.deleteDuplicates(listNode);
        ListNode.visit(listNode);
    }
}
